package com.atguigu.principle.liskov;

/**
 * @program: design-patterns
 * @author: yangshen
 * @description: 里氏替换原则
 * @create: 2022-01-10 22:42
 **/
public class Liskov {
    public static void main(String[] args) {
        A a = new A();
        System.out.println("11-3=" + a.func1(11, 3));
        System.out.println("1-8=" + a.func1(1, 8));

        System.out.println("-----------------------");

        B b = new B();
        //这里本意是求出11-3 (本意是想调用父类A的func1方法 使a-b， 可是子类B重写了父类A的方法，实际是调用B类的func1方法 a+b )
        System.out.println("11-3=" + b.func1(11, 3));
        // 1-8
        System.out.println("1-8=" + b.func1(1, 8));
        System.out.println("11+3+9=" + b.func2(11, 3));
    }
}
